home *** CD-ROM | disk | FTP | other *** search
/ Windows News 2010 Summer - Disc 1 / WN_Ete2010_CD1.iso / Onglet5 / Weezo / Weezo setup.exe / {code_appDir} / www / res / administration / config / windows.php < prev   
PHP Script  |  2010-05-19  |  4KB  |  123 lines

  1. <?php
  2. /**
  3.  * Account windows / desktop remote configuration
  4.  *
  5.  * PHP version 5
  6.  *
  7.  * LICENSE: This source file is subject to version 3.0 of the PHP license
  8.  * that is available through the world-wide-web at the following URI:
  9.  * http://www.php.net/license/3_0.txt.  If you did not receive a copy of
  10.  * the PHP License and are unable to obtain it through the web, please
  11.  * send a note to license@php.net so we can mail you a copy immediately.
  12. *
  13.  * @category   NA
  14.  * @package    NA
  15.  * @author     Nicolas Bruley / Peer 2 World <contact@weezo.net>
  16.  * @copyright  2005-2009 Nicolas Bruley / Peer 2 World
  17.  * @license    http://www.php.net/license/3_0.txt  PHP License 3.0
  18.  * @version    CVS: $Id:$
  19.  * @link       http://www.weezo.net
  20.  * @since      File available since Release 2.0.0
  21.  */
  22.  
  23. require_once(INCLUDE_DIR.'outputFunctions.php');
  24.  
  25. // Initialize data
  26. outControlSetData(array(
  27.     'language'=>((cfUGetVar('language'))?cfUGetVar('language'):'default'),
  28.     'noPopup'=>cfHGetVar('noPopup'),
  29.     'windowsAnimation'=>cfHGetVar('windowsAnimation')
  30. ));
  31.  
  32. // Header
  33. if(cfIsAsync()) {
  34.     cfAsyncHeader();
  35. }
  36. else {
  37.     cfInsertHEAD();
  38.     echo '<body onload="init()">';
  39.     echo outDivFrame('frame1','id="mainDiv"');
  40.     echo '<div class="frame1Header">'.cfCaption('genConfigure').'</div>';
  41. }
  42.  
  43. // Build languages list
  44. $lngs['default']=cfCaption('genDefault');
  45. foreach (glob(cfAppDocRoot().'/includes/lng/*.php') as $value){
  46.     include_once($value);
  47.     $short=cfFileWithoutExtension(basename($value));
  48.     $lngs[$short]=$w_lng['languageName'];
  49. }
  50.  
  51. // Display / process controls
  52. $out='';
  53. $out.=outControl('noPopup',dataBoolean,true,false,cfCaption('configNoPopup')).'<br><br>';
  54. $out.=outControl('windowsAnimation',dataBoolean,true,false,cfCaption('configWindowsAnimation'));
  55.  
  56.  
  57. foreach ($lngs as $k=>$v)
  58.     $lngsDef[]=array(outImage('/includes/lng/'.(($k=='default')?'noFlag':$k).'.gif'),$k,array($v,'<br> '));
  59.     //$lngsDef[]=array(false,$k,array(outImage('/includes/lng/'.(($k=='default')?'noFlag':$k).'.gif'),$v));
  60.  
  61. //array(false,'flash',array(outIcon('flash'),cfCaption('musicCfgFlash').'</td><td>'));
  62.  
  63. $out.='<br><br>'.cfCaption('configLanguage')."<br>  \n";
  64. $out.=outControl('language',dataList,'default',array_keys($lngs),$lngsDef);
  65.  
  66.  
  67.  
  68. if(cfIsAsync()) {
  69.     // If data has changed
  70.     if(outControlGetData($options)) {
  71.         if(isset($options['language'])){
  72.             $prev=cfGGetVar('language');
  73.             // Existing language required
  74.             if(cfMIssetVar('weezoLng'.$options['language'])){
  75.                 cfGSetVar('language',$options['language']);
  76.                 unset($_ENV['weezoLng']);
  77.                 cfLoadLanguage($options['language']);
  78.             }
  79.             // default (browser) or error
  80.             else{
  81.                 // Try with browser's language
  82.                 if(isset($_SERVER['HTTP_ACCEPT_LANGUAGE']) && strlen($_SERVER['HTTP_ACCEPT_LANGUAGE'])>1 && cfMIssetVar('weezoLng'.substr($_SERVER['HTTP_ACCEPT_LANGUAGE'],0,2)))
  83.                     cfGSetVar('language',substr($_SERVER['HTTP_ACCEPT_LANGUAGE'],0,2));
  84.                 // Else use default language
  85.                 else
  86.                     cfGUnsetVar('language');
  87.                 $options['language']='default';
  88.             }
  89.             if(cfGGetVar('language')!=$prev) echo cfAsyncXMLJSaction('winMe.reloadDesktop()');
  90.         }
  91.         foreach ($options as $k=>$v) cfUSetVar($k,$v);
  92.         // Single user account: commit to user configuration
  93.         if(cfUGetVar('accountType')=='singleUser') {
  94.             require_once(INCLUDE_DIR.'resourceConfigFunctions.php');
  95.             rcUserSaveValues($options);
  96.         }
  97.     }
  98.     echo $outControlAsyncResponse;
  99.     die(cfAsyncFooter());
  100. }
  101.  
  102. echo $out;
  103.  
  104.  
  105. ?>
  106. </div>
  107. <script type="text/javascript">
  108. function init(){
  109.     winMe.resizeInnerTo(0,actualOffsetBottom(dgi("mainDiv"))+10);
  110.     winMe.freezeSize();
  111. }
  112. function asUpdtFunction(dataName,dataValue){
  113.     if(dataName=='noPopup'||dataName=='windowsAnimation'){
  114.         var win=W;
  115.         while(!win.isMainFrame){
  116.             try{if(!win.parent || win.parent!=win) win=win.parent else break} catch(e){break}
  117.         }
  118.         if(win.isMainFrame) win[dataName]=dataValue;
  119.     }
  120. }
  121. <?php echo outKeyHandler('D',array('27'=>'winMe.closeMe()'));?>
  122. </script>
  123. </body>